package main

import (
	"fmt"
	"log"
	"io"
)

//func main() {
//	aa:= function1()
//	fmt.Println(aa)
//	function2(4)
//}

func function1() ( aa int){
	fmt.Printf("In function1 at the top\n")
	defer func () int {return aa+3}()
	fmt.Printf("In function1 at the bottom!\n")
	return 10
}

func function2(a int) {
	fmt.Printf("function2: Deferred until the end of the calling function! %d\n" ,a)
}
func func2(s string) (n int, err error) {
	defer func() {
		log.Printf("func1(%q) = %d, %v", s, n, err)
	}()
	return 7, io.EOF
}

func main() {
	func2("Go")
}